#include <jni.h>
#include "android/log.h"
#include <cmath>

extern "C"
jint Java_com_xinye_jnitest_JNIUtils_powInt(JNIEnv *env,jclass clazz,jint num,jint powInt){
    float result = pow((float)num,(float)powInt);
    float ceilResult = ceilf(result);

    __android_log_print(ANDROID_LOG_INFO,"wangheng","num:%d,powInt:%d,result:%f",num,powInt,ceilResult);

    return (int)ceilResult;
}

extern "C"
JNIEXPORT void JNICALL
Java_com_xinye_jnitest_JNIUtils_printByNative(JNIEnv *env, jclass clazz, jstring tag,
                                              jstring content) {
    jboolean isTagCopy;
    const char *cTag = env->GetStringUTFChars(tag,&isTagCopy);

    jboolean isContentCopy;
    const char *cContent = env->GetStringUTFChars(content,&isContentCopy);
    __android_log_print(ANDROID_LOG_INFO,cTag,">>>>>>>>>>>> 打印开始 >>>>>>>>>>");
    __android_log_print(ANDROID_LOG_INFO,cTag,
            "isTagCopy:%d,isContentCopy:%d,content is:%s",isTagCopy,isContentCopy,cContent);
    __android_log_print(ANDROID_LOG_INFO,cTag,">>>>>>>>>>>> 打印结束 >>>>>>>>>>");

    env->ReleaseStringUTFChars(tag,cTag);
    env->ReleaseStringUTFChars(content,cContent);
}